package com.bicon.botu.mall.goods.processor.medical;

import com.bicon.botu.mall.goods.vo.DrugPriceVo;
import com.bicon.botu.mall.goods.mapper.ProductRepertoryMapper;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * 医疗模块Rpc
 *
 * @author: 吕祥
 * @Date: Created in 15:22 2017/9/9/009
 */
@RestController
@RequestMapping("/V1.0.0/rpc/goods")
public class MedicalRpc {

    @Autowired
    private ProductRepertoryMapper productRepertoryMapper;

    /**
     * 根据skuId集合查询商品价格(医疗)
     *
     * @param skuIds skuId集合
     * @return
     */
    @RequestMapping(value = "/getDrugPrice", method = RequestMethod.POST)
    public List<DrugPriceVo> getDrugPrice(@RequestParam(value = "skuIds") List<String> skuIds) {
        List<DrugPriceVo> drugPriceVoList = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(skuIds)) {
            drugPriceVoList = productRepertoryMapper.findBySkuId(skuIds);
        }
        return drugPriceVoList;
    }

}
